﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections;
using CommomFunctions;
using System.Windows.Media.Animation;

namespace Filas
{
    /// <summary>
    /// Interaction logic for Queues.xaml
    /// </summary>
    public partial class Queues : Window
    {
        /// <summary>
        /// Variable that contains the information about the controls and their operations.
        /// </summary>
        ControlVariables ctrls = new ControlVariables();

        /// <summary>
        /// Constructor that executes the default initialization and then creates the other necessary controls 
        /// </summary>
        public Queues()
        {
            InitializeComponent();
            createQueue();
        }

        /// <summary>
        /// Creates the Queue. 
        /// The array "btns" contains all the buttons in the project. It will be used to control
        /// which button is enabled or disabled according to the operation that is being executed.
        /// </summary>
        public void createQueue()
        {
            Button[] btns = { btnCreate, btnDestroy, btnInsert, btnRemove };
            ctrls.btnsToEnableDisable(btns);
            ctrls.addOtherControls(Gridi);            
        }

        private void grid_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            ctrls.gridSizeChanged();
        }

        #region Buttons click events controls
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            ctrls.buttonClicked(ButtonClicked.Create);            
        }

        private void btnDestroy_Click(object sender, RoutedEventArgs e)
        {
            ctrls.buttonClicked(ButtonClicked.Destroy);
        }
        
        private void btnInsert_Click(object sender, RoutedEventArgs e)
        {
            ctrls.buttonClicked(ButtonClicked.Insert);
        }
        
        private void btnRemove_Click(object sender, RoutedEventArgs e)
        {
            ctrls.buttonClicked(ButtonClicked.Remove);
        }
        #endregion

        #region Menu click events controls
        private void about_Click(object sender, RoutedEventArgs e)
        {
             Ajuda.openAbout();            
        }
        
        private void help_Click(object sender, RoutedEventArgs e)
        {
            Ajuda.openHelp();
        }

        private void tutorial_Click(object sender, RoutedEventArgs e)
        {
            Ajuda.openTutorial("Fila.wmv");
        }
        #endregion

    }
}
